
int count = 0;

class movie_item{

  int rank;//等级
  String imageUrl;//海报
  String title;//电影名
  String playDate;//上映日期
  double rating;//星
  List<String>genres;//题材
  List<actor>casts;//演员
  Director director;//导演
  String originalTitle;//英文名


  movie_item.from(Map<String, dynamic> json){
    this.rank = count ++;
    this.imageUrl = json['images']['medium'];
    this.title = json['title'];
    this.playDate = json['year'];
    this.rating = json['rating']['average'];
    this.genres = json['genres'].cast<String>();
    this.casts = (json['casts'] as List<dynamic>).map((item){
      return actor.fromMap(item);
    }).toList();
    this.director = Director.fromMap(json['directors'][0]);
    this.originalTitle = json['original_title'];

  }


}

class person{

  String name;
  String avatar;

  person.fromMap(Map<String , dynamic> json){
    this.name = json['name'];
    this.avatar = json['avatars']['medium'];
  }

}

//导演
class Director extends person{
  Director.fromMap(Map<String,dynamic> json):super.fromMap(json);
}

//演员
class actor extends person{
  actor.fromMap( Map<String ,dynamic> json) :super.fromMap(json);
}